//
//  KYDiseaseDetailModel.m
//  kuaiyi
//
//  Created by 杨亮 on 16/3/15.
//  Copyright © 2016年 kuaiyi. All rights reserved.
//

#import "KYDiseaseDetailModel.h"
#import "KYNetTool.h"
#import <MJExtension.h>

@implementation KYDiseaseDetailModel
+(void)getDiseaseDetailModelSuccess:(void(^)(NSArray *diseaseDetail))success withPage:(NSInteger)page wihtDiseaseType:(NSInteger)diseaseType{
    
    NSString *url = @"http://iosapi.itcast.cn/searchCI3List.json.php";
    NSDictionary *paramDic = @{@"login_token":@"985c96ce43bb5ef69de3e1ad8afaa83f",@"keyword":@"",@"ci1_id":@(diseaseType),@"page_size":@(15),@"page":@(page)};
    [[KYNetTool shareManager]POST:url parameters:paramDic progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:nil];
        NSArray *data = dict[@"data"];
        NSMutableArray *array = [NSMutableArray array];
//        NSLog(@"%@",data);
        for (NSDictionary *dictArray in data) {
            KYDiseaseDetailModel *model = [KYDiseaseDetailModel mj_objectWithKeyValues:dictArray];
            [array addObject:model];
        }
        if (success) {
            success(array.copy);
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"%@",error.description);
    }];
}
@end
